package zmee.pur.src.formplugin;

import kd.bos.bill.BillShowParameter;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.form.FormShowParameter;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.operate.FormOperate;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import zmee.util.BosUtil;
/**
* @author lijiawang
* @Date 2022/11/28 9:46
* @Description:
*/
public class SrcPublishwinnoticePlugin extends AbstractFormPlugin {
    @Override
    public void beforeDoOperation(BeforeDoOperationEventArgs args) {
        FormOperate formOperate=(FormOperate)args.getSource();
        String key = formOperate.getOperateKey();
        if("inform".equals(key)){
            String billno = this.getModel().getValue("billno").toString();
            DynamicObject notice = BusinessDataServiceHelper.loadSingle("pds_noticesupplier", "id", new QFilter[]{new QFilter("project.billno", QCP.equals, billno)});
            if(StringUtils.isNotBlank(notice)){
                BillShowParameter BillShowParameter = BosUtil.openForm("pds_noticesupplier", notice.getPkValue().toString());
                this.getView().showForm(BillShowParameter);
            }else{
                this.getView().showMessage("未找到相应的供应商！");

            }

        }
    }
}
